'use strict'


let data={}
class seemessage {

  constructor (mdb) {
    this.mdb = mdb || null
  }
  async post(c){
    let d=JSON.parse(c)
    console.log('这是洞主查看其他人的投档记录 需要提交字段treeid',JSON.parse(c))
      data.treeid=d.treeid
  }
  async get () {
    
    console.log('这是data数据1111',data)
    try{
      let sql=`select * from tree_message,users where tree_message.treeid=${data.treeid} and tree_message.userid=users.uid`
      let r=await this.mdb.query(sql)
      let result=r['rows']

      console.log(result)
      if(result.rowCount<=0){
        return ('failed register',400)
      }
      return result

    }catch(e){
      return ('failed',400)
    }
  }
  

}

module.exports =seemessage
